<template>
    <div>
        <!-- 模态框 -->
        <el-dialog title="删除用户" :visible.sync="thistype" @close='fun(tname)'>
           <div style="text-align:center;">
               你确定要删除角色
               <span style="color:deepskyblue;"> {{tablerow.name}}</span>
              吗？
               </div>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click='mgrdelete'>确 定</el-button>
            </div>
        </el-dialog>
        <!-- 模态框 结束 -->
    </div>
</template>
<script>
import {http,deptlist,role} from '../../api/api.js'
export default {
    props:['type','fun','tablerow','tname'],
    data() {
        return {
            thistype:this.type,//模态框状态
        }
    },
    
    methods: {
        mgrdelete(){
            this.$http.delete(http+role,{
                params:{
                    roleId:this.tablerow.id
                }
            }).then((data)=>{
                if(data.data.msg=='成功'){
                    this.thistype=false
                }else{
                    this.$message.error(data.data.msg)
                }
            },(err)=>{
                 this.$message.error(err.data.message)
            })
            
        }
    },
    watch:{
        type(){
            this.thistype=this.type
        }
    }
}
</script>
<style lang="">
    
</style>